<?php
/*********************/
/*                   */
/*  Version : 5.1.0  */
/*  Author  : RM     */
/*  Comment : 071223 */
/*                   */
/*********************/

define( "JIEQI_MODULE_NAME", "system" );
require_once( "../global.php" );
include_once( JIEQI_ROOT_PATH."/class/power.php" );
$power_handler =& jieqipowerhandler::getinstance( "JieqiPowerHandler" );
$power_handler->getsavedvars( "system" );
jieqi_checkpower( $jieqiPower['system']['adminreport'], $jieqiUsersStatus, $jieqiUsersGroup, false, true );
jieqi_loadlang( "report", JIEQI_MODULE_NAME );
if ( empty( $_REQUEST['id'] ) )
{
		jieqi_printfail( $jieqiLang['system']['report_no_exists'] );
}
$GLOBALS['_REQUEST']['id'] = intval( $_REQUEST['id'] );
include_once( JIEQI_ROOT_PATH."/class/report.php" );
$report_handler = jieqireporthandler::getinstance( "JieqiReportHandler" );
$report = $report_handler->get( $_REQUEST['id'] );
if ( !$report )
{
		jieqi_printfail( $jieqiLang['system']['report_no_exists'] );
}
jieqi_getconfigs( JIEQI_MODULE_NAME, "rsort", "jieqiRsort" );
include_once( JIEQI_ROOT_PATH."/admin/header.php" );
$jieqiTpl->assign( "reportid", $_REQUEST['id'] );
$jieqiTpl->assign( "siteid", $report->getvar( "siteid" ) );
$jieqiTpl->assign( "reporttime", $report->getvar( "reporttime" ) );
$jieqiTpl->assign( "reportuid", $report->getvar( "reportuid" ) );
$jieqiTpl->assign( "reportname", $report->getvar( "reportname" ) );
$jieqiTpl->assign( "authtime", $report->getvar( "authtime" ) );
$jieqiTpl->assign( "authuid", $report->getvar( "authuid" ) );
$jieqiTpl->assign( "authname", $report->getvar( "authname" ) );
$jieqiTpl->assign( "reporttitle", $report->getvar( "reporttitle" ) );
include_once( JIEQI_ROOT_PATH."/lib/text/textconvert.php" );
$ts = textconvert::getinstance( "TextConvert" );
$jieqiTpl->assign( "reporttext", $ts->makeclickable( $report->getvar( "reporttext" ) ) );
$jieqiTpl->assign( "reportsize", $report->getvar( "reportsize" ) );
$jieqiTpl->assign( "reportfield", $report->getvar( "reportfield" ) );
$jieqiTpl->assign( "authnote", $report->getvar( "authnote" ) );
$jieqiTpl->assign( "reportsort", $report->getvar( "reportsort" ) );
$jieqiTpl->assign( "reporttype", $report->getvar( "reporttype" ) );
$jieqiTpl->assign( "authflag", $report->getvar( "authflag" ) );
$jieqiTpl->assign( "sortname", $jieqiRsort[$report->getvar( "reportsort" )]['caption'] );
if ( isset( $jieqiRsort[$report->getvar( "reportsort" )]['types'][$report->getvar( "reporttype" )] ) )
{
		$jieqiTpl->assign( "typename", $jieqiRsort[$report->getvar( "reportsort" )]['types'][$report->getvar( "reporttype" )] );
}
else
{
		$reportrows[$k]['typename'] = $jieqiTpl->assign( "typename", $jieqiLang['system']['report_type_other'] );
}
$jieqiTpl->setcaching( 0 );
$jieqiTset['jieqi_contents_template'] = JIEQI_ROOT_PATH."/templates/admin/reportdetail.html";
if ( $report->getvar( "authflag" ) == 0 )
{
		$report->setvar( "authflag", "1" );
		$report_handler->insert( $report );
}
include_once( JIEQI_ROOT_PATH."/admin/footer.php" );
?>
